package com.gzx.plugin.tjzy.modular.debtor.mapper;


import com.gzx.plugin.tjzy.modular.debtor.entity.GzxDebtorInfo;
import com.gzx.plugin.tjzy.modular.debtor.entity.vo.GzxDebtorInfoVo;
import org.apache.ibatis.annotations.Insert;
import vip.xiaonuo.common.mapper.BaseMapperPlus;

import java.util.List;

/**
 * 欠款人信息Mapper接口
 *
 * @author LionLi
 * @date 2024-09-18
 */
public interface GzxDebtorInfoMapper extends BaseMapperPlus<GzxDebtorInfo, GzxDebtorInfoVo> {

    @Insert("<script>" +
            "insert ignore into gzx_debtor_info" +
            "(project_code, debtor_name, debtor_sex, debtor_phone, debtor_card_id," +
            "debtor_birth, debtor_age, debtor_province, debtor_city, debtor_address," +
            "debtor_now_address, debtor_account_balance, " +
            "tenant_id,create_user, create_time,update_user, update_time) " +
            "values " +
            "<foreach collection='debtorInfoList' item='item' index='index' separator=','>" +
            "(#{item.projectCode},#{item.debtorName},#{item.debtorSex},#{item.debtorPhone},#{item.debtorCardId}," +
            "#{item.debtorBirth},#{item.debtorAge},#{item.debtorProvince},#{item.debtorCity},#{item.debtorAddress}," +
            "#{item.debtorNowAddress},#{item.debtorAccountBalance}," +
            "#{item.tenantId},#{item.createUser},#{item.createTime},#{item.updateUser},#{item.updateTime})" +
            "</foreach>" +
            "</script>")
    void insertBatchIgnore(List<GzxDebtorInfo> debtorInfoList);


    /**
     * 批量新增欠款人信息
     *
     * @param batchSql
     */
    @Insert("<script>" +
            "INSERT ignore INTO gzx_debtor_info (project_code, debtor_name, debtor_sex, debtor_phone, debtor_card_id, " +
            "debtor_birth, debtor_age, debtor_province, debtor_city, debtor_address, " +
            "debtor_now_address, debtor_account_balance,tenant_id,create_user,create_time) " +
            "VALUES ${batchSql}" +
            "</script>")
    void insertBatchIgnoreBySql(String batchSql);
}
